import { createApp } from 'vue';
import App from './App.vue';
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import { ElConfigProvider } from 'element-plus'
import zhCn from 'element-plus/lib/locale/lang/zh-cn'

import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
import '@/assets/global.css'

import { createRouter, createWebHashHistory } from "vue-router";
import routes from './routes/routes';

const router = createRouter({
    // 4. 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。
    history: createWebHashHistory(),
    routes // `routes: routes` 的缩写
});

router.beforeEach((to, from, next) => {
    NProgress.start();
    next();
})

router.afterEach(() => {
    NProgress.done();
})

const app = createApp(App);
app.use(ElementPlus, {
    locale: zhCn,
    size: 'small',
    zIndex: '2000'
});
app.use(router);
app.mount('#app')